//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "SniperTraining\fn_ehHandleDamage.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_target","_selectionName","_damage","_shooter","_params"];
DEFAULT_PARAM(_target,0,objNull);
DEFAULT_PARAM(_selectionName,1,"");
DEFAULT_PARAM(_damage,2,0);
DEFAULT_PARAM(_shooter,3,objNull);

if (IS_OBJECT(_target) && _selectionName == "" && _damage > 0.01 && {!isnull _target}) then {
	if (!isnull (_shooter) && {isplayer _shooter}) then {
		_params = [
			_shooter,
			_damage,
			_target distance _shooter,
			_target
		];
		["TargetShot",_params] call FUNC(callEvent);
	};
};

TRACE("End");
TMFPROFILERSTOP;
0